﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using PinYinSpell;

public class SpeakPronounce : MonoBehaviour
{
    public string inputChinese;
    public string inputPinYin;

    PronounceCore core;

    void Start()
    {
        core = GetComponent<PronounceCore>();
    }

    // 汉字转拼音
    public void OnConvert()
    {
        inputPinYin = core.ConvertPinYin(inputChinese);
    }

    // 播放拼音
    public void OnSpeak()
    {
        core.Speak(inputPinYin);
    }

    // 转换并播放
    public void ConvertAndSpeak()
    {
        string py = core.ConvertPinYin(inputChinese);
        core.Speak(py);
    }
}
